{{- $count := default 5 .Site.Params.featuredPostCount -}}
{{- if $count -}}
  {{- $featuredPosts := first $count (where (where site.RegularPages "Type" "in" site.Params.mainSections) ".Params.featured" "eq" true) -}}
  {{- with $featuredPosts -}}
  <section class="featured-posts row surface">
    <h4>{{ T "featured_posts" }}</h4>
    <ul>
    {{- range . -}}
      <li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
    {{- end -}}
    </ul>
  </section>
  {{- end -}}
{{- end -}}
